% Obtain the empirical CDF of values on a grid
function[ecdf] = my_ecdf(values,grid)
    ecdf = ones(length(grid),1);
    for x = 1:numel(grid)
       ecdf(x) = length(values(values<=grid(x)))/length(values); 
    end
end